/**
 * Created by xiaomin on 2015/6/18.
 */

var BaseService = angular.module('BaseService',['ngResource']);

BaseService.factory('BaseService',['$resource',
    function($resource){
        var BaseService;

        BaseService = {
            getList: function(url){
                return $resource(url,{}).get().$promise;
            },
            add: function(url,data){
                return  $resource(url,{},{
                    add:{method:'POST',params:{}}
                }).add(data).$promise;

            },
            delete:function(url,id){
                return  $resource(url,{},{
                    delete:{method:'POST',params:{}}
                }).delete(id).$promise;
            },
            unique:function(url,id){
                return $resource(url,{},{
                    getById:{method:'GET',params:{}}
                }).getById(id).$promise;
            },
            update:function(url){
                return  $resource(url,{},{
                    update:{method:'POST',params:{}}
                }).update(data).$promise;
            }
        };
        return BaseService;
}]);

